<?php
function create_feedback_table()
{
	global $wpdb;

	$feedback = $wpdb->prefix . "feedback";

	//check if there are any tables of that name already
	if ($wpdb->get_var("show tables like '$feedback'") !== $feedback)
	{
		//create your sql
		$sql = "
        CREATE TABLE {$feedback} (
        feedback_id MEDIUMINT (12) NOT NULL AUTO_INCREMENT,
        send_by VARCHAR (200) NOT NULL,
        send_email VARCHAR (200) NOT NULL,
        title TEXT NOT NULL,
        send_content LONGTEXT NOT NULL,
        TIME DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
        reply CHAR(5),
        UNIQUE KEY feedback_id (feedback_id)
        );
        ";
	}

	//include the wordpress db functions
	require_once (ABSPATH . 'wp-admin/upgrade-functions.php');
	dbDelta($sql);

	//register the new table with the wpdb object
	if (!isset($wpdb->follow))
	{
		$wpdb->follow = $feedback;

		//add the shortcut so you can use $wpdb->follow
		$wpdb->tables[] = str_replace($wpdb->prefix, '', $feedback);
	}
}
//add to front and backend inits
add_action('init', 'create_feedback_table');
?>